<template>
	<view class="page">
		<!-- 蓝色背景区域 -->
		<view class="blue-header"></view>
		
		<!-- 成功卡片 -->
		<view class="success-card">
			<!-- 成功图标 -->
			<view class="success-icon">
				<view class="icon-circle">
					<text class="checkmark">✓</text>
				</view>
			</view>
			
			<!-- 成功消息 -->
			<view class="success-message">
				<text class="primary-text">提交成功</text>
				<text class="secondary-text">等待平台审核</text>
			</view>
			
			<!-- 返回按钮 -->
			<view class="return-btn" @click="returnToHome">
				<text class="return-text">返回首页({{countdown}}s)</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				countdown: 5,
				timer: null
			}
		},
		onLoad() {
			// 页面加载时开始倒计时
			this.startCountdown();
		},
		onUnload() {
			// 页面卸载时清除定时器
			if (this.timer) {
				clearInterval(this.timer);
			}
		},
		methods: {
			// 开始倒计时
			startCountdown() {
				this.timer = setInterval(() => {
					this.countdown--;
					if (this.countdown <= 0) {
						clearInterval(this.timer);
						this.returnToHome();
					}
				}, 1000);
			},
			// 返回首页
			returnToHome() {
				if (this.timer) {
					clearInterval(this.timer);
				}
				uni.reLaunch({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>

<style>
	.page {
		background-color: #f5f5f5;
		/* height: 100vh; */
		display: flex;
		flex-direction: column;
		position: relative;
		overflow: hidden;
	}
	
	.blue-header {
		width: 100%;
		height: 33.33vh;
		background-color: #007AFF;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 0;
	}
	
	.success-card {
		background-color: white;
		border-radius: 20rpx;
		padding: 80rpx 60rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.1);
		width: calc(100% - 120rpx);
		max-width: 500rpx;
		margin: 200rpx 60rpx 40rpx 60rpx;
		position: relative;
		z-index: 1;
	}
	
	.success-icon {
		margin-bottom: 40rpx;
	}
	
	.icon-circle {
		width: 120rpx;
		height: 120rpx;
		border-radius: 60rpx;
		background: linear-gradient(135deg, #007AFF 0%, #0056CC 100%);
		display: flex;
		justify-content: center;
		align-items: center;
		box-shadow: 0 8rpx 20rpx rgba(0, 122, 255, 0.3);
	}
	
	.checkmark {
		font-size: 60rpx;
		color: white;
		font-weight: bold;
		line-height: 1;
	}
	
	.success-message {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 60rpx;
	}
	
	.primary-text {
		font-size: 48rpx;
		font-weight: bold;
		color: #333;
		margin-bottom: 20rpx;
		text-align: center;
	}
	
	.secondary-text {
		font-size: 32rpx;
		color: #666;
		text-align: center;
	}
	
	.return-btn {
		width: 100%;
		height: 80rpx;
		background-color: #007AFF;
		border-radius: 40rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		box-shadow: 0 4rpx 20rpx rgba(0, 122, 255, 0.3);
	}
	
	.return-text {
		font-size: 32rpx;
		color: white;
		font-weight: bold;
	}
</style>
